home *** CD-ROM | disk | FTP | other *** search
- Path: abcfd20.larc.nasa.gov!amiga-request
- From: amiga-request@abcfd20.larc.nasa.gov (Amiga Sources/Binaries Moderator)
- Subject: v90i268: deadalloc 1.23 - allocate ``dead tracks'', Part01/01
- Reply-To: ins425v@monu4.cc.monash.edu.au (mr t.h. mackenzie)
- Newsgroups: comp.sources.amiga
- Message-ID: <comp.sources.amiga:v90i268@abcfd20.larc.nasa.gov>
- Date: 08 Oct 90 23:47:35 GMT
- Approved: tadguy@uunet.UU.NET (Tad Guy)
- X-Mail-Submissions-To: amiga@uunet.uu.net
- X-Post-Discussions-To: comp.sys.amiga
-
- Submitted-by: ins425v@monu4.cc.monash.edu.au (mr t.h. mackenzie)
- Posting-number: Volume 90, Issue 268
- Archive-name: util/deadalloc-1.23/part01
-
- [ uuencoded executable enclosed ...tad ]
-
- This is a program which allocates dead tracks on amiga OFS floppys and
- creates a file to stop their deallocation. Source/Docs/Binaries included.
- Compiles under DICE. This is my origional work.
-
-
- #!/bin/sh
- # This is a shell archive. Remove anything before this line, then unpack
- # it by saving it into a file and typing "sh file". To overwrite existing
- # files, type "sh file -c". You can also feed this as standard input via
- # unshar, or by typing "sh <file", e.g.. If this archive is complete, you
- # will see the following message at the end:
- # "End of archive 1 (of 1)."
- # Contents: DeadAlloc.doc DeadAlloc.uu Deadalloc.c
- # Wrapped by tadguy@abcfd20 on Mon Oct 8 19:47:33 1990
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f 'DeadAlloc.doc' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'DeadAlloc.doc'\"
- else
- echo shar: Extracting \"'DeadAlloc.doc'\" \(2948 characters\)
- sed "s/^X//" >'DeadAlloc.doc' <<'END_OF_FILE'
- X
- XDeadAlloc - A program for allocating dead tracks on AmigaDos [OFS] floppys.
- X
- X(c) Tim MacKenzie.
- X13/8/90.
- X
- X---------------------------------------------------------------------
- XThis program may be freely redistributed and modified as long as this
- Xcopyright message remains intact and such activity is not for profit.
- XThe author (thats me) takes no responsibility for any damage/loss/&c
- Xresulting from the use/misuse of this program.
- X----------------------------------------------------------------------
- X
- X
- XEveryone (well nearly) has a few disks which have a few dead tracks on them
- Xmaking them (the disks) quite useless to AmigaDos when you try to write
- Xto them. IbM owners dont worry about this as their OS kindly allocates
- Xthese tracks and continues on it's merry way (It's only a simple minded
- Xsystem so it's allowed to be _merry_). AmigaDos is not quite so kind,
- Xso here is this program to do the allocation for you.
- X
- XThis program creates a file "...dead" which contains all of the
- Xdead/unusable tracks on a floppy. This allows the floppy to be used
- Xnormally for data, programs etc. The program does not recover tracks,
- Xit just tells the file system that they are allocated and are hence not
- Xused for 'useful' data. Creation of the file "...dead" stops the tracks
- Xbeing deallocated when the disk is re-validated after a crash &c.
- X
- XTo use:
- X DeadAlloc [df?:] [-n] [-m]
- X
- X :- df? selects the drive to operate on. [default is df1:]
- X :- -m stops the program from creating the file.
- X :- -n allows the program to doubly allocate tracks. ie. It will
- X reallocate tracks (This is not a good idea)
- X
- X DeadAlloc ?
- X Will display the options.
- X
- XNotes:
- X 1: It is a good idea to use the program on empty disks. This prevents
- X the situation of reallocating a block which belongs to an
- X existing file.
- X 2: The file created has no delete privaliges. To delete it you must
- X change it's protection with 'protect ...Dead +d'
- X 3: The program will exit if a '...Dead' file already exists.
- X 4: If you reallocate blocks then delete both files which have a claim
- X to that block then you will receive a 'Disk corrupt' message.
- X 5: Sometimes the disk checker will not pick up a dead track. In this
- X case you should delete the '...Dead' file and retry.
- X 6: The source compiles with DICE. Manx/Lattice users need to change
- X the #includes and include Open/Close Library routines
- X !!thanx Matt!!.
- X 7: A disk with tracks 40 or 0 dead may be unrecoverable/unuseable.
- X 8: If you use the program on disks with existing files and it informs
- X you that a block is already allocated then no file will be
- X created and no blocks allocated. You must remove the
- X offending file and retry.
- X
- X
- XMy Address.
- X Tim MacKenzie.
- X 36 Alexander Ave
- X Upwey, Victoria.
- X AUSTRALIA. 3158.
- X
- XInternet: ins425v@monu4.cc.monash.edu.au (til Nov '90)
- X ins425v@monu3.cc.monash.edu.au ( ----"----)
- X
- XAny Donations, suggestions, thanx, Fan mail, flames etc are most welcome :-}
- END_OF_FILE
- if test 2948 -ne `wc -c <'DeadAlloc.doc'`; then
- echo shar: \"'DeadAlloc.doc'\" unpacked with wrong size!
- fi
- # end of 'DeadAlloc.doc'
- fi
- if test -f 'DeadAlloc.uu' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'DeadAlloc.uu'\"
- else
- echo shar: Extracting \"'DeadAlloc.uu'\" \(15756 characters\)
- sed "s/^X//" >'DeadAlloc.uu' <<'END_OF_FILE'
- Xbegin 666 DeadAlloc
- XM```#\P`````````"``````````$```EW```"40```^D```EW2.<_/BQY````)
- XM!"1/+P@O`#`\``!G5"`\```!`-"\```!4>6`4(`J`"(\``$``$ZN_SI*@&8(J
- XM+DIP_V```,8@0$*8(,5)Z'_^1^C_^$/Y`````"`\```!46`"(-E1R/_\D+P`E
- XM`0``9/)@#$GY`````$GL?_Z7RT'L@`(@/````5'E@-'`(#P```$`<@!@`B#!^
- XM4<C__)"\``$``&3R*4N%3BE*A4IP`"(\```0`$ZN_LXI3H5&3KD``"/<3KD`U
- XM`"/X3KH+0DAY`````$AY`````"QLA49.N0``)`Q.N0``(_PJ;(5*("R%3F<2O
- XM)$`F4B`J``0B2DZN_RX@"V;N("\`!"Y-3-]\_$YU3E4``$ALA3E.N@\:6(](G
- XM>```3KH`TEB/2'@"`"\LAIQ.NB.Z4(](;(9L3KHD=%B/2&R&2DZZ(_I8CTAXY
- XM``!.N@I,6(].74YU3G5.50``2'@``DAX`@!.NB-L4(\I0(:<2JR&G&8.2&R%C
- XM!$ZZ#KA8CTZZ"AI(>```3KHC>EB/*4"&1BELAD:&6DALADI.NB..6(](>```+
- XM2&R&;!`L@"9(@$C`+P!(;(3S3KHCUD_O`!!*@&<22&R$QDALA-=.N@YF4(].Z
- XMN@G(0>R&2BE(AGHY?``"AH@I;(:<AI0I?````@"&D$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_WPL7TYU+PXL;(5&3G%,[P`#``A.KO\Z+%].=0``+PXL;(5&3G$B;P`(("\`X
- XM#$ZN_RXL7TYU+PXL;(5&3G$B;P`(3J[^VBQ?3G4O#BQLA49.<2`O``A.KO["/
- XM+%].=2\.+&R%1DYQ(F\`"$ZN_IXL7TYU+PXL;(5&3G$B;P`(3J[^F"Q?3G4OS
- XM#BQLA49.<2!O``A.KOZ,+%].=2\.+&R%1DYQ(F\`"$ZN_H8L7TYU+PXL;(5&!
- XM3G$@;P`(3J[^@"Q?3G4O#BQLA49.<2!O``A,[P(!``PB+P`43J[^1"Q?3G4`/
- XM`"\.+&R%1DYQ(F\`"$ZN_CXL7TYU+PXL;(5&3G$B;P`(3J[^."Q?3G5D;W,NJ
- XM;&EB<F%R>0````/L````!0````````"V````O````-P```#6```CZ`````(`:
- XM```!````;````$X````````#\@```^H```%1`````"H```````````,``#`Q]
- XM,C,T-38W.#E!0D-$148``````0``````!+8```2E```$D0``!(,```1T```$]
- XM90``!%4```1#```$,P``!"8```0;```$$0``!`$```/R```#Y0```]I.;W<@M
- XM<F5M;W9E('1H92!D:7-K(&%N9"!R96EN<V5R="!I="!B969O<F4@=7-I;F<N=
- XM"@!$96QE=&4@;V9F96YD:6YG(&9I;&4O<R!O<B!U<V4@+6X@;W!T:6]N("AD=
- XM86YG97)O=7,A*0H`4V]M92!D96%D('1R86-K<R!A<F4@86QL;V-A=&5D('1O&
- XM(&5X:7-T:6YG(&9I;&5S+@H`5F]L=6UE.B`E<RX@0FET;6%P(&]N("5D+@H`I
- XM17)R;W(@<F5A9&EN9R!R;V]T(&)L;V-K+B!1=6ET=&EN9RX*`$-H86YG92!I]
- XM="=S('!R;W1E8W1I;VX@86YD(&1E;&5T92!I="X@5&AE;B!R971R>0H`1FELP
- XM92`B+BXN1&5A9"(@86QR96%D>2!E>&ES=',@;VX@9')I=F4@9&8E,60Z+@H`0
- XM9&8Q.BXN+D1E860`("`@(&1F/SH@4V5T(&1R:79E(&YU;6)E<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P96-I9FEE9`!T<F%C:V1I<VLN9&5V`
- XM:6-E`$-O=6QD;B=T(&]P96X@)7,N(&5X:71I;F<N"@!T<F%C:V1I<VLN9&5VF
- XM:6-E`$-A;G0@9V5T(#4Q,B!B>71E<R`H5VAA="!I<R!H87!P96YI;F<@=&\@K
- XM;7D@=V]R;&0_*0H`FR!PFS`[,S%M`````````^P````0`````0```&0```!@F
- XM````7````%@```!4````4````$P```!(````1````$`````\````.````#0`8
- X3```P````+````"@````````#\DP`%
- X``
- Xend
- Xsize 11224
- END_OF_FILE
- if test 15756 -ne `wc -c <'DeadAlloc.uu'`; then
- echo shar: \"'DeadAlloc.uu'\" unpacked with wrong size!
- fi
- # end of 'DeadAlloc.uu'
- fi
- if test -f 'Deadalloc.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Deadalloc.c'\"
- else
- echo shar: Extracting \"'Deadalloc.c'\" \(11087 characters\)
- sed "s/^X//" >'Deadalloc.c' <<'END_OF_FILE'
- X/*
- X * deadalloc.c Dead track allocator.
- X * (c)Tim MacKenzie .
- X *
- X * This program is freely redistributable. It may be modified, hacked and
- X * mutilated as long as this is not for profit, this message must also
- X * remain with it.
- X *
- X * Begun: 17/6/90
- X * History:
- X * v1.0: Allocates dead blocks only.
- X * v1.1: Creates file with dead blocks in it.
- X * v1.2: Checks every block instead of just the first on a track
- X * v1.21: Repaired some bugs in 1.2.
- X * v1.22: Doesnt include blocks 0 and 1 in file list.
- X * v1.23: Now doesn't write new bitmap if reallocating blocks.
- X */
- X
- X#define REV "v1.23"
- X#define DATE "13/8/90"
- X
- X#include <devices/trackdisk.h>
- X/* This should include lots of things with it (I hope) */
- X#include <exec/memory.h>
- X#include <stdio.h>
- X#include <ctype.h>
- X#include <proto/exec.h>
- X#include <proto/dos.h>
- X/* Works with DICE */
- X/* Need open_lib's with Aztec or Lattice */
- X
- Xstruct Task *my_task;
- Xstruct MsgPort port;
- Xstruct IOStdReq req;
- XUBYTE *m_data; /* Sector buffer */
- Xchar drive=1; /* Which drive to access */
- Xchar error_list[160];
- Xlong bitblock;
- Xchar n_opt;
- Xchar doubly_alloc=0;
- X/* This flag gets set if a track is already allocated and is dead */
- X
- Xstruct file_head {
- X long type;
- X long key;
- X long num_block;
- X long dat_size;
- X long first;
- X long sum;
- X long blocks[72];
- X long res[2];
- X long prot;
- X long size;
- X char comment[92];
- X long date[3];
- X char name[64];
- X long hash;
- X long parent;
- X long extens;
- X long sec;
- X} head;
- X
- Xclose_all()
- X{/* Closes anything that was opened in open_all()
- X */
- X printf("\x9b\x20\x70\x9b0;31\x6d");
- X /* Back to normal */
- X read_track(0);
- X FreeMem(m_data,512);
- X CloseDevice(&req);
- X RemPort(&port);
- X exit(0);
- X}
- X
- Xchkabort()
- X{/* Dont let anyone take control away from me!*/
- X}
- X
- Xopen_all()
- X{/* This opens the trackdisk device and assoc stuff.
- X */
- X m_data=AllocMem(512,MEMF_CHIP);
- X if (!m_data) {
- X printf("Cant get 512 bytes (What is happening to my world?)\n");
- X exit();
- X }
- X my_task=FindTask(0L); /* Find my task! */
- X port.mp_SigTask=my_task;
- X AddPort(&port);
- X if(OpenDevice(TD_NAME,(long)drive,&req,0L)) {
- X printf("Couldn't open %s. exiting.\n",TD_NAME);
- X exit();
- X }
- X req.io_Message.mn_ReplyPort=&port;
- X req.io_Command=CMD_READ;
- X req.io_Data=m_data;
- X req.io_Length=TD_SECTOR;
- X}
- X
- X
- Xread_track(track)
- Xint track;
- X{/* Reads the track specified into the buffer.
- X */
- X int error;
- X req.io_Command=CMD_READ;
- X req.io_Length=TD_SECTOR;
- X req.io_Offset= track *512;
- X req.io_Data=m_data;
- X error=DoIO(&req);
- X req.io_Command=TD_MOTOR;
- X req.io_Length=0;
- X DoIO(&req); /* Turn motor off */
- X return(error);
- X}
- X
- Xwrite_track(track)
- Xlong track;
- X{/* Writes the track specified into the buffer.
- X */
- X long error;
- X req.io_Command=CMD_WRITE;
- X req.io_Length=TD_SECTOR;
- X req.io_Offset= track *512;
- X req.io_Data=m_data;
- X error=DoIO(&req);
- X req.io_Command=TD_MOTOR;
- X req.io_Length=0;
- X DoIO(&req); /* Turn motor off */
- X return(error);
- X}
- X
- Xdisplay_err(err)
- Xint err;
- X{/* Displays the error number and interpretation.
- X */
- X static char *msgs[]={
- X "Not Specified",
- X "No sector header",
- X "Bad Sector Preamble",
- X "Bad Sector ID",
- X "Bad Header sum",
- X "Bad Sector sum",
- X "Too Few Sectors",
- X "Bad Sector Header",
- X "Write Protected",
- X "Disk Changed",
- X "Seek error",
- X "No Memory",
- X "Bad Unit Number",
- X "Bad Drive Type",
- X "Drive in use",
- X "Post Reset"
- X };
- X printf("Error %ld: %s\n",err,msgs[err-20]);
- X}
- X
- Xcheck_disk()
- X{/* This routine checks the disk for errors and fills up the error_list array
- X */
- X long i;
- X long err;
- X int count;
- X req.io_Command=CMD_READ;
- X req.io_Length=512;
- X count=0;
- X printf("\x9b\x30\x20\x70");
- X for (i=0;i<160;i++) {
- X long j;
- X printf("Track %d.\n",i);
- X printf("\x9b\x41");
- X for (j=0;j<11;j++) {
- X req.io_Offset=(i*11 +j)*512;
- X err=DoIO(&req);
- X if (err) {
- X printf("Track %d: ",i);
- X display_err(err);
- X error_list[i]=1;
- X count++;
- X break;
- X }
- X }
- X }
- X printf("\x9b\x20\x70");
- X printf("Check complete. %d errors.\n",count);
- X req.io_Command=TD_MOTOR;
- X req.io_Length=0;
- X DoIO(&req);
- X return(count);
- X}
- X
- Xwarn(bit)
- Xint bit;
- X{
- X ULONG *dat;
- X ULONG block;
- X long err;
- X printf("Warning: block %d is allocated\n",bit);
- X doubly_alloc=1;
- X}
- X
- X
- Xdead_alloc()
- X{/* This is the bit that allocates the dead blocks.
- X */
- X int i,j;
- X ULONG sum;
- X long bit,err;
- X err=read_track(bitblock);
- X if (err) {
- X display_err(err);
- X printf("The bitmap block has an error... quitting \n");
- X return;
- X }
- X for (i=0;i<160;i++) {
- X if (error_list[i]) {
- X for (j=0;j<11;j++) {
- X bit=32+ i*11 +j -2;
- X if (bit>=32) {
- X if (!(((ULONG *)m_data)[bit/32] & (1<<(bit%32)))) warn(bit);
- X ((ULONG *)m_data)[bit/32] = (((ULONG *)m_data)[bit/32]) & ~((ULONG)1 << (bit%32));
- X }
- X }
- X }
- X }
- X fix_bit_sum(m_data);
- X do {
- X err=write_track(bitblock);
- X if (err) {
- X char c;
- X printf("Error writing bitblock: ");
- X display_err(err);
- X printf("Retry? ");
- X fflush(stdout);
- X scanf("%c",&c);
- X if (!(c=='y' || c=='Y')) err=0;
- X }
- X } while (err);
- X}
- X
- Xfix_bit_sum(dat)
- XULONG *dat;
- X{
- X ULONG sum,i;
- X sum=0;
- X for (i=1;i<128;i++)
- X sum= sum+((ULONG *)dat)[i];
- X ((ULONG *)dat)[0] = -sum;
- X}
- X
- Xfix_block_sum(dat)
- XULONG *dat;
- X{
- X ULONG sum,i;
- X sum=0;
- X for (i=0;i<128;i++)
- X if (i!=5)
- X sum= sum+((ULONG *)dat)[i];
- X ((ULONG *)dat)[5] = -sum;
- X}
- X
- Xlong
- Xfind_free()
- X{/* Finds a free block, allocates it and returns it's address.
- X */
- X long i,j,i1,j1;
- X long err;
- X err=read_track(bitblock);
- X if (err) return(0);
- X for (i1=880;i1<1760;i1++) {
- X j1=1760-i1;
- X i=i1+30;
- X j=j1+30;
- X if (((ULONG *)m_data)[i/32] & (1 << (i%32))) {
- X ((ULONG *)m_data)[i/32] = (((ULONG *)m_data)[i/32]) & ~((ULONG)1 << (i%32));
- X fix_bit_sum(m_data);
- X write_track(bitblock);
- X return(i1);
- X }
- X else if ((((ULONG *)m_data)[j/32] & (1 << (j%32))&&j>31)) {
- X ((ULONG *)m_data)[j/32] = (((ULONG *)m_data)[j/32]) & ~((ULONG)1 << (j%32));
- X fix_bit_sum(m_data);
- X write_track(bitblock);
- X return(j1);
- X }
- X }
- X}
- X
- Xdead_file(count)
- Xlong count;
- X{/* This creates the file "...dead" in the root directory of the disk
- X * with the dead blocks in it.
- X */
- X long upto,err,which,howmany,next,i;
- X int lower;
- X if (error_list[0]==1) lower=2;
- X else lower=0;
- X if(!(which=find_free())) {
- X printf("Error allocating block for ...Dead file\n");
- X return;
- X }
- X head.type=2;
- X head.key=which;
- X head.prot=0x007;
- X strcpy(head.comment,"\x21 File for holding dead tracks in.");
- X strcpy(head.name,"\7...Dead");
- X head.parent=880;
- X head.sec=-3;
- X for (upto=0,howmany=0;upto<1760 && howmany<72;upto++)
- X if (error_list[upto/11] && upto>=2) {
- X head.blocks[71-howmany]=upto;
- X howmany++;
- X }
- X head.num_block=howmany-lower;
- X head.size=(count*11-lower)*488;
- X head.first=head.blocks[71];
- X read_track(880);
- X head.hash=((ULONG *)m_data)[61];
- X ((ULONG *)m_data)[61]=which;
- X /* ^^ 61 is the hash value for ...Dead . If you change
- X * the name then you have to change the hash value.
- X */
- X fix_block_sum(m_data);
- X write_track(880);
- X next=0;
- X if (howmany==72) {
- X if(!(next=find_free())) {
- X printf("Error allocating block for ...Dead file\n");
- X return;
- X }
- X head.extens=next;
- X }
- X for (i=0;i<128;i++)
- X ((ULONG *)m_data)[i]=((ULONG *)&head)[i];
- X fix_block_sum(m_data);
- X write_track(which);
- X /* Here make extension blocks if number of blocks > 72 */
- X while (upto<1760) {
- X long next_ext;
- X next_ext=0;
- X head.type=0x10;
- X for (howmany=0;upto<1760 && howmany<72;upto++)
- X if (error_list[upto/11]) {
- X head.blocks[71-howmany]=upto;
- X howmany++;
- X }
- X for (i=howmany;i<72;i++)
- X head.blocks[71-i]=0;
- X head.num_block=howmany;
- X head.hash=0;
- X for (i=0;i<92;i++) head.comment[i]=0;
- X for (i=0;i<64;i++) head.name[i]=0;
- X head.prot=0;
- X head.size=0;
- X head.parent=which;
- X head.key=next;
- X head.first=0;
- X head.extens=0;
- X if (howmany==72) {
- X next_ext=find_free();
- X head.extens=next_ext;
- X }
- X for (i=0;i<128;i++)
- X ((ULONG *)m_data)[i]=((ULONG *)&head)[i];
- X fix_block_sum(m_data);
- X write_track(next);
- X next=next_ext;
- X }
- X}
- X
- Xmain(argc,argv)
- Xint argc;
- Xchar *argv[];
- X{
- X BPTR in;
- X int i,count;
- X int err,nofile;
- X nofile=0;
- X printf("\x9b33;4mDead track allocator %s.\x9b0;33m ) Tim MacKenzie %s.\x9b31m\n",REV,DATE);
- X for (i=1;i<argc;i++) {
- X if (argv[i][0]!='-' && argv[i][0]!='d') {
- X printf("Usage: %s [-m] [-n] [df?:] \n",argv[0]);
- X printf(" -m : Modify bitmap only. Dont add file\n");
- X printf(" -n : Allow reallocation of blocks\n");
- X printf(" df?: Set drive number (default is drive 1)\n");
- X exit(1);
- X }
- X if (argv[i][1]=='m') {nofile=1; continue;}
- X if (argv[i][1]=='n') {n_opt=1; continue;}
- X if (argv[i][1]=='f') {
- X drive=argv[i][2]-'0';
- X if (drive <0 || drive >4) {
- X argv[i][0]='0';
- X i--;
- X continue;
- X }
- X continue;
- X }
- X }
- X if (!nofile) {
- X char name[12];
- X strcpy(name,"df1:...Dead");
- X name[2]='0'+drive;
- X in = Open(name,MODE_OLDFILE);
- X if (in) {
- X printf("File \"...Dead\" already exists on drive df%1d:.\n",drive);
- X printf("Change it's protection and delete it. Then retry\n");
- X Close(in);
- X exit();
- X }
- X }
- X open_all();
- X err=read_track(880);
- X if(err) {
- X display_err(err);
- X printf("Error reading root block. Quitting.\n");
- X close_all();
- X }
- X bitblock=((long *)m_data)[79];
- X printf("Volume: %s. Bitmap on %d.\n",&m_data[(108<<2)+1],bitblock);
- X count=check_disk();
- X if (count) {
- X dead_alloc();
- X if (!n_opt && doubly_alloc) {
- X printf("Some dead tracks are allocated to existing files.\n");
- X printf("Delete offending file/s or use -n option (dangerous!)\n");
- X close_all();
- X }
- X if (!nofile)
- X dead_file(count);
- X printf("Now remove the disk and reinsert it before using.\n");
- X }
- X close_all();
- X}
- END_OF_FILE
- if test 11087 -ne `wc -c <'Deadalloc.c'`; then
- echo shar: \"'Deadalloc.c'\" unpacked with wrong size!
- fi
- # end of 'Deadalloc.c'
- fi
- echo shar: End of archive 1 \(of 1\).
- cp /dev/null ark1isdone
- MISSING=""
- for I in 1 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have the archive.
- rm -f ark[1-9]isdone
- else
- echo You still need to unpack the following archives:
- echo " " ${MISSING}
- fi
- ## End of shell archive.
- exit 0
- --
- Mail submissions (sources or binaries) to <amiga@uunet.uu.net>.
- Mail comments to the moderator at <amiga-request@uunet.uu.net>.
- Post requests for sources, and general discussion to comp.sys.amiga.
-